package org.ice4apps.master.dao;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Session entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "session", catalog = "icemaster")
public class Session implements java.io.Serializable {
    // Fields
    private String  id;
    private Client  client;
    private String  loginId;
    private Integer type;
    private Long    loginRefreshTime;

    // Constructors
    /** default constructor */
    public Session () {
    }

    /** minimal constructor */
    public Session (String id,
                    Client client,
                    String loginId,
                    Long loginRefreshTime) {
        this.id = id;
        this.client = client;
        this.loginId = loginId;
        this.loginRefreshTime = loginRefreshTime;
    }

    /** full constructor */
    public Session (String id,
                    Client client,
                    String loginId,
                    Integer type,
                    Long loginRefreshTime) {
        this.id = id;
        this.client = client;
        this.loginId = loginId;
        this.type = type;
        this.loginRefreshTime = loginRefreshTime;
    }

    // Property accessors
    @Id
    @Column(name = "id", unique = true, nullable = false, length = 36)
    public String getId () {
        return this.id;
    }

    public void setId (String id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "client", nullable = false)
    public Client getClient () {
        return this.client;
    }

    public void setClient (Client client) {
        this.client = client;
    }

    @Column(name = "login_id", nullable = false, length = 36)
    public String getLoginId () {
        return this.loginId;
    }

    public void setLoginId (String loginId) {
        this.loginId = loginId;
    }

    @Column(name = "type")
    public Integer getType () {
        return this.type;
    }

    public void setType (Integer type) {
        this.type = type;
    }

    @Column(name = "login_refresh_time", nullable = false)
    public Long getLoginRefreshTime () {
        return this.loginRefreshTime;
    }

    public void setLoginRefreshTime (Long loginRefreshTime) {
        this.loginRefreshTime = loginRefreshTime;
    }
}